import { _decorator, Node } from 'cc';
import { AudioManager } from '../../../common/src/manager/AudioManager';
import { UIManager } from '../../../framework/ui/uimanager/UIManager';
import { MonoUIPanel } from '../../../common/src/mono/MonoUIPanel';
import { EVENT_NAMES } from '../../../common/src/util/Enums';
import DataMgr from '../../../common/src/util/DataMgr';
const { ccclass, property } = _decorator;

@ccclass('UnlockDialog')
export class UnlockDialog extends MonoUIPanel {

    // =======================================
    // ------------ 生命周期
    // =======================================
    onEnable(): void {
        super.onEnable()
    }

    // =======================================
    // ------------ 事件
    // =======================================
    // ----------------- 点击事件 ----------------- //
    private async onClosePanel() {
        AudioManager.playButton()
        await this.onExitAnimation()
        
        UIManager.close("unlock:res/prefab/UnlockDialog")
    }

    // 解锁
    public onClickUnlockButton() {
        DataMgr.currentMaxSlotCount++
        gg.systemEvent.emit(EVENT_NAMES.UNLOCK_TEMPORARILY_SLOT)
        this.onClosePanel()
    }
}


